package com.txzt.gaea.gen.controller;

import org.beetl.sql.core.SQLManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Validated
@RestController
@RequestMapping("/gen")
public class generatorController {

    @Autowired
    protected SQLManager sqlManager;

    @GetMapping(value = "/create")
    public Map<String,String> create(@RequestParam String tableName) throws Exception {
        sqlManager.genPojoCodeToConsole(tableName);
        sqlManager.genSQLTemplateToConsole(tableName);
        return null;
    }
}
